<template>
  <div>
    <h1>{{title}}</h1>
    <h1>{{msg}}</h1>
    <h1 @click="$emit('childClick',msg)">{{title}}</h1>
    <button @click="sendMsg()">发送Child组件的消息</button>
  </div>
</template>
<script>
  import { ref } from "vue";
  import bus from "vue3-eventbus";
  export default {
    props: {
      title: String
    },
    setup() {
      const msg = ref("我是子组件的值");
      const sendMsg = () => {
        bus.emit("getMsg", "我是来自Child组件的消息")
      }
      return {
        msg,
        sendMsg
      }
    }

  }
</script>